package com.imeth.cms.dao;


import com.imeth.base.MyBatisDao;
import com.imeth.base.model.Paging;
import com.imeth.cms.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by Administrator on 2015/12/20.
 */
@MyBatisDao
public interface CategoryDao {

    @Options(useGeneratedKeys=true, keyProperty="id")
    @Insert("insert into t_category(name) values(#{name})")
    int save(Category category);

    @Update("update t_category set name=#{name}  where id=#{id}")
    int update(Category category);

    @Delete("delete from t_category where id=#{id}")
    int deleteById(Integer id);

    @Select("select * from t_category where id=#{id}")
    Category getById(Integer id);

    @Select("select count(1) from t_category")
    int count();

    @Select("select * from t_category limit #{startRow},#{pageSize}")
    List<Category> query(Paging paging);
}